package com.sky.controller.wx;

import com.sky.service.OrdersService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "模拟接收微信支付成功接口")
public class WXPayController {
    @Autowired
    private OrdersService ordersService;

    /**
     * 模拟接收微信发来的支付成功
     * @param orderNum
     * @return
     */
    @GetMapping("/success")
    @ApiOperation("模拟接收微信发来的支付成功接口")
    public String paySuccess(String orderNum){
        ordersService.paySuccess(orderNum);
        return "我已经知道支付成功了";
    }

    /**
     * 模拟接收微信发来的退款成功
     * @param orderNum
     * @return
     */
    @GetMapping("/refund")
    @ApiOperation("模拟接收微信发来的退款成功接口")
    public String refundSuccess(String orderNum){
        ordersService.refundSuccess(orderNum);
        return "我已经知道退款成功了";
    }
}
